<?

require_once("cms/core/helper/Abstract.php");

class PHP_CMS_View_Helper_LanguageRoute extends PHP_CMS_View_Helper_Abstract {

    public function languageRoute($item, $title, $id, $language, $default=null) {

        if(is_null($default))
            $default = $this->param(_Core::DEFAULT_LANGUAGE);

        $sb = "";

        if($id > 0) {
            $sb .= $this->message("route.edit", _Core::BUNDLE) . " " . strtolower($item) . " \"".$title."\" ";
        } else if ($default != $language->getCode()) {
            $sb .= $this->message("title.translate", _Core::BUNDLE)." ". strtolower($item) ." \"".$title."\" ";
        } else {
            $sb .= $this->message("route.new", _Core::BUNDLE) . " " . strtolower($item) . " ";
        }

        if($this->param(_Core::I18N))
            $sb .= "<img src=\"static.php?file=".$this->image("cms/core/view/gfx/flag/".strtolower($language->getCode()).".png")."\"" .
                        "width=\"16\" height=\"11\" alt=\"".$language->getName()."\" ".
                        "title=\"".$language->getName()."\" class=\"flag\" />" .
                        ($default != $language->getCode() && $id <= 0 ? " ".$this->message("title.to", _Core::BUNDLE)." " : " ".$this->message("title.in", _Core::BUNDLE)." ")
                        . strtolower($language->getName()) .".";

        return $sb;


    }

}

?>